package com.kili.cloud.shorturl.controller;

import com.kili.cloud.shorturl.service.TestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @description: 测试类
 * @author: tom.liu
 * @date: 2019/6/19 16:18
 */
@RestController
@Api(tags="Swagger2测试类",value="Swagger2测试类")
public class TestController {

    @Autowired
    TestService testService;

    @GetMapping("/getClientIp")
    @ApiOperation(value="测试Swagger2方法注解", notes="获取当前ip")
    public String getClientIp(HttpServletRequest request) {

        String ip = testService.getClientIp(request);
        System.out.println(ip);
        return ip;
    }

    @GetMapping("/getIp")
    @ApiOperation(value="测试Swagger2方法注解", notes="获取当前ip")
    public String getIp(String url) {

        return "";
    }


}
